<?php
namespace app\index\controller;
use think\Controller;

/**
 * 基础
 * Class Base
 * @package app\index\controller
 */
class Base extends Controller{
    /**
     * 授权实例
     * @var null|\OCAP\InstantMessaging\Auth\Client
     */
    protected $clinet = null;
    /**
     * 构造器
     * Base constructor.
     */
    public function __construct(){
        parent::__construct(...func_get_args());
        /**
         * 获取授权实例
         */
        $this -> clinet = new \OCAP\InstantMessaging\Auth\Client(new \OCAP\InstantMessaging\Bridge\Config([
            // 应用id
            'app_id'=>'yZn6ezqm7JGr59BtHuSERPaKWjAhxY3i',
            // 应用秘钥
            'access_key'=>'NA3UsCRyI6Z9wtEdMf2hVJXPYScxT584KDeaHnkujigmQpqFbGvrz7WB',
            // RSA公钥
            'rsa_public'=>'-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDnbL7NV9hjB4Oo44LzyyzXFoZr
7VazdFFA15nPxEiRX13f9IpGardXMlcCI1Lu5XtF6Vgd+LHPqodb/cOs7IDL9N3A
qO1yzMQ1wUw68CjvIpviBi5CnXjoBCfTusrWfqwA2BDcG94HQpwpHg2b+05TUh6A
oFQtir22s/ZAUoPN8wIDAQAB
-----END PUBLIC KEY-----'
        ]));
        /**
         * 设置缓存驱动
         */
        $this -> clinet -> setCache(new \Doctrine\Common\Cache\FilesystemCache('./data'));
    }
}